package net.sunofbeach.blog.controller.portal;

import net.sunofbeach.blog.pojo.GuideIp;
import net.sunofbeach.blog.response.ResponseResult;
import net.sunofbeach.blog.services.IGuideIpService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;

@RestController
@RequestMapping("/portal/guide")
public class GuideIpApi {

    @Autowired
    private IGuideIpService guideIpService;
    //增加一个访客
    @PostMapping
    public ResponseResult postNewGuide(@RequestBody GuideIp guideIp, HttpServletRequest request) {
        return guideIpService.postGuideIp(guideIp,request);
    }

    //列出访客
    @GetMapping("/list/{page}/{size}")
    public ResponseResult listNewComments(@PathVariable("page") int page,
                                          @PathVariable("size") int size) {
        return guideIpService.listGuideIps(page, size);
    }
}
